package day04;


public class MyQueue {
    int[] data = new int[10000];
    int head = 0, tail = -1;//a[head::tail]

    void offer(int x) {
        data[++tail] = x;
    }

    void poll() {
        ++head;
    }

    int peek() {
        return data[head];
    }

    int size() {
        return tail - head + 1;
    }

    boolean empty() {
        return head > tail;
    }

    public static void main(String[] args) {
        MyQueue queue = new MyQueue();//FIFO
        for (int i = 1; i <= 10; i++) {
            queue.offer(i);
        }
        while (!queue.empty()) {
            System.out.print(queue.peek() + " ");
            queue.poll();
        }
    }
}